package com.gxa.service.impl;


import com.gxa.mapper.CustomerTypeMapper;
import com.gxa.pojo.CustomerType;
import com.gxa.service.CustomerTypeService;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;
@Data
@NoArgsConstructor
@Service("CustomerTypeService")
public class CustomerTypeServiceImpl implements CustomerTypeService{

    @Autowired
    CustomerTypeMapper customerTypeMapper;

    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,rollbackFor = {Throwable.class})
    public int insert(Map map) {
        return customerTypeMapper.insert(map);
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,rollbackFor = {Throwable.class})
    public int deleteByPrimaryKey(Integer id) {
        return customerTypeMapper.deleteByPrimaryKey(id);
    }

    // 批量删除
    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,rollbackFor = {Throwable.class})
    public int deleteBatch(List<Integer> list) {
        return customerTypeMapper.deleteBatch(list);
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED,rollbackFor = {Throwable.class})
    public int updateByPrimaryKeySelective(Map map) {
        return customerTypeMapper.updateByPrimaryKeySelective(map);
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.SUPPORTS,rollbackFor = {Throwable.class})
    public Integer findAllCustomerType() {
        return customerTypeMapper.findAllCustomerType();
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.SUPPORTS,rollbackFor = {Throwable.class})
    public List<CustomerType> findAllCustomerTypeByPage(Integer start, Integer pageSize) {
        return customerTypeMapper.findAllCustomerTypeByPage(start,pageSize);
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.SUPPORTS,rollbackFor = {Throwable.class})
    public List<Map<String, Object>> findCustomerTypeName() {
        return customerTypeMapper.findCustomerTypeName();
    }


}
